import { DeleteDto, IndexDto, ShowDto } from '@libs/common/dto';
import { ApiProperty, PartialType } from '@nestjs/swagger';
import { IsBoolean, IsDateString, IsNotEmpty } from 'class-validator';

import { Performance } from '../entities/performance.entity';

export class IndexPerformanceDto extends IndexDto<Performance> {}

export class ShowPerformanceDto extends ShowDto {}

export class DeletePerformanceDto extends DeleteDto {}

export class CreatePerformanceDto {}

export class UpdatePerformanceDto extends PartialType(CreatePerformanceDto) {
  @ApiProperty()
  @IsNotEmpty({ message: 'id 不能为空' })
  id: string;
}

export class SwitchPerformanceDto {
  @ApiProperty()
  @IsNotEmpty({ message: 'id 不能为空' })
  id: string;

  @ApiProperty({ description: '状态' })
  @IsNotEmpty({ message: '状态不能为空' })
  @IsBoolean()
  status: boolean;
}

export class ImportPerformanceDto {
  @IsNotEmpty({ message: '日期不能为空' })
  @IsDateString()
  date: string;
}

export class ExportPerformanceDto {}

export class FindPerformanceDto {
  @ApiProperty({ description: '用户ID，三选一' })
  userId?: string;

  @ApiProperty({ description: '钉钉ID，三选一' })
  dingId?: string;

  @ApiProperty({ description: '姓名，三选一' })
  name?: string;
}
